package br.biofoco.p2p.scheduling;

import java.io.File;

import com.google.inject.internal.Objects;

public class BlastTask implements Task {
	
	private long id;
	private TaskStatus status;
	private int replica;
	private String tool;
	private File file;
	
	public BlastTask(long taskID) {
		id = taskID;
		status = TaskStatus.PENDING;
		replica = 1;
	}

	@Override
	public long getID() {
		return id;
	}

	@Override
	public int getReplicaCount() {
		return replica;
	}

	@Override
	public TaskStatus getStatus() {
		return status;
	}

	@Override
	public void increaseReplicaCount() {
		replica++;			
	}

	@Override
	public void setReplicaCount(int i) {
		replica = i;			
	}

	@Override
	public void setStatus(TaskStatus newStatus) {
		status = newStatus;			
	}
	
	@Override
	public String toString() {
		return "[" + id + ":" + status + ":" + replica + ":" + "]";
	}

	public void setTool(String tool) {
		this.tool = tool;
	}

	public String getTool() {
		return tool;
	}

	public void setFile(File file) {
		this.file = file;
	}

	public File getFile() {
		return file;
	}
	
	
	@Override
	public int hashCode() {
		return Long.valueOf(id).hashCode();
	}
	
	@Override
	public boolean equals(Object object) {
		
		if (this == object)
			return true;
		
		if (!(object instanceof BlastTask)){
			return false;
		}
		
		BlastTask other = (BlastTask) object;
		
		return this.id == other.id;
	}
	
}
